package com.feihao.controller;

import com.feihao.domain.Student;
import com.feihao.service.StudentService;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/studentServlet")
public class StudentController {

    @Reference
    private StudentService studentService;

    @GetMapping("/{currentPage}/{pageSize}")
    public PageInfo<Student> selectAll(@PathVariable Integer currentPage,Integer pageSize) {
        System.out.println(currentPage+","+pageSize);
        System.out.println("执行");
        return studentService.selectAll();
    }

    @RequestMapping("/addStu")
    public void addStu(Student stu) {
        studentService.addStu(stu);
    }

    @RequestMapping("/updateStu")
    public void updateStu(Student stu) {
        studentService.updateStu(stu);
    }

    @RequestMapping("/deleteStu")
    public void deleteStu(String number) {
        studentService.deleteStu(number);
    }

}
